package com.qd.common.sys.domain.entity.dict;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cdqidi.util.page.BaseQuery;
import com.cdqidi.valid.group.DefaultGroup;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;

/**
 * @author sjk
 * 数据字典
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
public class DictDataDTO extends BaseQuery {
    @ExcelIgnore
    @JsonIgnore
    private static final String EXCEL_TITLE = "数据字典";
    /**
     * 主键
     */
    @ExcelProperty(value = {EXCEL_TITLE, "*字典ID"}, order = 1)
    @Size(max = 50, message = "字典ID长度不能超过{max}位", groups = {DefaultGroup.class})
    private String id;
    /**
     * 名称
     */
    @ExcelProperty(value = {EXCEL_TITLE, "*名称"}, order = 2)
    @NotBlank(message = "名称不能为空", groups = DefaultGroup.class)
    @Size(max = 100, message = "名称长度不能超过{max}位", groups = {DefaultGroup.class})
    private String name;
    /**
     * 排序
     */
    @ExcelProperty(value = {EXCEL_TITLE, "*排序"}, order = 3)
    @NotNull(message = "排序不能为空", groups = DefaultGroup.class)
    private Integer idx;
    /**
     * 状态
     */
    @ExcelIgnore
    @NotNull(message = "状态不能为空", groups = DefaultGroup.class)
    private Integer status;
    /**
     * 状态显示值
     */
    @ExcelProperty(value = {EXCEL_TITLE, "*状态"}, order = 4)
    private String statusDisplay;
    /**
     * 码表类型
     */
    @ExcelIgnore
    @NotBlank(message = "字典类型不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "字典类型长度不能超过{max}位", groups = DefaultGroup.class)
    private String typeId;
    /**
     * 类型ID显示值
     */
    @ExcelProperty(value = {EXCEL_TITLE, "*字典类型"}, order = 5)
    private String typeIdDisplay;
    /**
     * 备注
     */
    @ExcelProperty(value = {EXCEL_TITLE, "备注"}, order = 6)
    @Size(max = 200, message = "备注长度不能超过{max}位", groups = DefaultGroup.class)
    private String remark;
    /**
     * 添加时间
     */
    @ExcelProperty(value = {EXCEL_TITLE, "添加时间"}, order = 7)
    private LocalDateTime addTime;
    /**
     * 更新时间
     */
    @ExcelProperty(value = {EXCEL_TITLE, "修改时间"}, order = 8)
    private LocalDateTime updateTime;

    @Override
    public void freeData() {
        this.id = null;
        this.name = null;
        this.idx = null;
        this.status = null;
        this.statusDisplay = null;
        this.remark = null;
        this.addTime = null;
        this.updateTime = null;
        this.typeId = null;
        this.typeIdDisplay = null;
        super.freeData();
    }
}
